package cn.joker.entity.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 操作日志记录表
 * </p>
 *
 * @author joker
 * @since 2025-04-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_operation_logs")
@ApiModel(value="OperationLogs对象", description="操作日志记录表")
public class OperationLogs implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "日志ID，主键自增")
    @TableId(value = "log_id", type = IdType.AUTO)
    private Long logId;

    @ApiModelProperty(value = "操作用户ID")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty(value = "操作用户名")
    @TableField("username")
    private String username;

    @ApiModelProperty(value = "操作描述")
    @TableField("operation")
    private String operation;

    @ApiModelProperty(value = "业务类型：1-新增, 2-修改, 3-删除, 4-授权, 5-导出, 6-导入, 7-强退, 8-生成代码, 9-清空数据")
    @TableField("business_type")
    private Integer businessType;

    @ApiModelProperty(value = "请求方法名")
    @TableField("method")
    private String method;

    @ApiModelProperty(value = "请求方式（GET/POST等）")
    @TableField("request_method")
    private String requestMethod;

    @ApiModelProperty(value = "请求参数")
    @TableField("params")
    private String params;

    @ApiModelProperty(value = "返回结果")
    @TableField("response")
    private String response;

    @ApiModelProperty(value = "操作IP地址")
    @TableField("ip")
    private String ip;

    @ApiModelProperty(value = "操作地点")
    @TableField("location")
    private String location;

    @ApiModelProperty(value = "操作状态：0-失败, 1-成功")
    @TableField("status")
    private Integer status;

    @ApiModelProperty(value = "错误消息")
    @TableField("error_msg")
    private String errorMsg;

    @ApiModelProperty(value = "操作时间")
    @TableField("operation_time")
    private LocalDateTime operationTime;

    @ApiModelProperty(value = "消耗时间（毫秒）")
    @TableField("cost_time")
    private Long costTime;


}
